/*
 * @Author: your name
 * @Date: 2019-10-21 09:08:46
 * @LastEditTime: 2019-10-29 15:40:13
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /c:\Users\DELL\Desktop\zhhu\app\Router\Book.js
 */
const jwt = require('koa-jwt')
const Router = require('koa-router');
const router=new Router({prefix:'/topic'});
const {find, findById, create,update,listTopicFollowers,checkTopicExist,listQuestion} =require('../controllers/topics')
const {secret} =require('../config');
const auth = jwt({secret})
router.get('/',find)//用户列表
router.post('/',auth,create)//创建用户
router.get('/:id',checkTopicExist,findById)//查询用户
router.patch('/:id',auth,checkTopicExist,update)
router.get('/:id/followingers',checkTopicExist,listTopicFollowers)
router.get('/:id/questions',checkTopicExist,listQuestion)


module.exports=router;